const axios = require('axios');
const MockAdapter = require('axios-mock-adapter');
const normalAxios = axios.create();
const mockAxios = axios.create();
import url_config from "./config";
import reqTools from "../utils/reqTools";

// mock 数据   广告机明细
var mock = new MockAdapter(mockAxios);


mock.onGet('/queryAll').reply((config) => {
  config.types="102,105";
  return new Promise(function(resolve, reject) {
    reqTools.get('/api/sysofficebalancelog',
    config).then((res) => {
      resolve([200, res.data]);
    }).catch((err) => {
      resolve([500, err ]);
    });
  });

});

mock.onDelete('/deleteBalancelog').reply((config) => {
  /* return new Promise(function(resolve, reject) {
    reqTools.delete( '/api/sysCnotice/'+config.id).then((res) => {
      resolve([200, res ]);
    }).catch((err) => {
      resolve([500, err ]);
    });
  }); */

  return new Promise(function(resolve, reject) {
    const ids= config.ids;
    reqTools.delete('/api/sysofficebalancelog/deletes',{ids}).then((res) => {
      resolve([200, res]);
    }).catch((err) => {
      resolve([500, err ]);
    });
  });
});


export default mockAxios;
